package com.fwtai.api;

import com.fwtai.bean.PageFormData;
import com.fwtai.datasource.DaoHandle;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 合同模板访问数据库
 */
@Repository
public class ApiContractTemplateDao{

  private final DaoHandle dao;

  public ApiContractTemplateDao(final DaoHandle dao){
    this.dao = dao;
  }

  public HashMap<String,String> queryExistById(final Long kid){
    return dao.queryForHashMapString("api_contract_template.queryExistById",kid);
  }

  public List<HashMap<String,String>> queryFiles(final long[] lists){
    return dao.queryForListString("api_contract_template.queryFiles",lists);
  }

  public HashMap<String,Object> queryById(final String kid){
    return dao.queryForHashMap("api_contract_template.queryById",kid);
  }

  public List<HashMap<String,Object>> getListData(final PageFormData formData){
    return dao.queryForListHashMap("api_contract_template.listData",formData);
  }

  /**查看指定用户上传的合同*/
  public List<Map<String,Object>> getListById(final PageFormData formData){
    return dao.queryForListMap("api_contract_template.getListById",formData);
  }

  public Integer getListTotal(final PageFormData formData){
    return dao.queryForInteger("api_contract_template.listTotal",formData);
  }

  // 获取表contract_template的字段contract_type的下拉框列动态值选项的数据
  public List<HashMap<String,Object>> getContract_type(final Long kid){
    return dao.queryForListHashMap("api_contract_template.getContract_type",kid);
  }

  public List<HashMap<String,Object>> getDomain_type(){
    return dao.queryForListHashMap("api_dict.getDomain");
  }
}